package chapter07_array;

import java.util.Arrays;

public class array {
    public static void main(String[] args) {
        int[] a = new int[10];
        for(int i = 0; i < a.length; i++)
            a[i] = (int)(Math.random() * 100);

        for(int t : a){
            System.out.print(t + " ");
        }
        System.out.println("");
        System.out.println(Arrays.toString(a));
        System.out.println("--------------------------");
        Arrays.sort(a);
        System.out.println(Arrays.toString(a));
        System.out.println("--------------------------");

        int[] b = {1,1,1,1,1,1,1,1,1,1};
        System.out.println("a equals b?  " + Arrays.equals(a,b));
        Arrays.fill(a,1);
        System.out.println("--------------------------");
        System.out.println("a equals b?  " + Arrays.equals(a,b));
        System.out.println("--------------------------");

        int[] c = {1,2,3,4,5,6,7,8,9};
        System.out.println(Arrays.binarySearch(c,3));
        System.out.println("--------------------------");
    }
}
